package com.tom.architect02.mnbase.jetpack.dagger2;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.tom.architect02.R;
import com.tom.architect02.mnbase.jetpack.dagger2.di.Presenter;
import com.tom.architect02.mnbase.jetpack.dagger2.object.HttpObject;
import javax.inject.Inject;

public class SecActivity extends AppCompatActivity {
    @Inject
    HttpObject httpObject;
    @Inject
    Presenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main37);
//        DaggerMyComponent.builder()
//                .httpModule(new HttpModule())
//                .databaseModule(new DatabaseModule())
//                .build()
//                //上面的代码初始化了module和component
//                .injectSecActivity(this);

        // 使用全局单例，注入。
        ((MyApplication)getApplication()).getMyComponent()
                .injectSecActivity(this);
        Log.i("jett",httpObject.hashCode()+"-sec");
        Log.i("jett",presenter.hashCode()+"-sec");
    }

}
